#!/bin/sh

DIRECT_DNS_SERVER_SERVICE="[[direct.dns.server.service]]"
JAMES3_SERVICE="[[james3.service]]"

TOMCAT7_USER="[[tomcat7.user]]"
TOMCAT7_GROUP="[[tomcat7.group]]"

chown \
	-R \
	"$TOMCAT7_USER:$TOMCAT7_GROUP" \
	"/var/lib/direct/direct-cert-discovery-tool" \
	"/var/lib/direct/mail" \
	"/var/lib/tomcat7/webapps" || exit

chmod \
	"g+w" \
	"/var/lib/direct" || exit

chgrp \
	"$TOMCAT7_GROUP" \
	"/var/lib/direct" || exit

update-rc.d \
	"$DIRECT_DNS_SERVER_SERVICE" \
	"defaults"

update-rc.d \
	"$JAMES3_SERVICE" \
	"defaults"
